package day0731;

import javax.swing.*;
import java.awt.*;

//父类//Bullet
public class FlyingObject {
    int x;
    int y;
    int speed;
    Image img;
    int imgWidth;
    int imgHeight;

    void move() {  }
}

class Bullet extends  FlyingObject{
    void move(){
        y= y-speed;
    }
    Bullet(){
        x=190;
        y=600;
        speed=15;
        ImageIcon iconImg=new ImageIcon("images/bullet.png");
        img=iconImg.getImage();//getImage方法：将ImageIcon转化为Image类型
        imgWidth=iconImg.getIconWidth();
        imgHeight=iconImg.getIconHeight();
    }
}
